<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="validate.css" />
    <script src="validate.js"></script>
  </head>
  <body>
    <form action="">
      用户名<input type="text" name="username" />
      <span id="username-error"></span>
      <hr />
      密码：<input type="text" name="password" value="ccc" style="width: 300px" />
      <span id="password-error"></span>
      <br />
      确认密码：<input type="text" name="confirm_password" />
      <hr />
      <button class="btn">提交</button>
    </form>
    <script>
      const validateObject = new Validate()
      validateObject.confirm(`password`, 'confirm_password', '两次密码不一致', '#password-error', 'keyup')
      validateObject.max(`username`, '用户名不能超过10位', 10, '#username-error', 'keyup')
    </script>
  </body>
</html>
